import { get, post } from '@/utils/request'

//获取所有文章
export async function getArticleList() {
    let [response, error] = await get(`/home/getArticleList`)
    //console.log(response)
    return response !== null ? response : error
}      

//获取指定文章内容
export async function getArticleById(id) {
    let [response, error] = await get(`/home/getArticleById/${id}`)
    //console.log(response)
    return response !== null ? response : error
}        

//获取分类列表内容
export async function getListById(id) {
    let [response, error] = await get(`/home/getListById/${id}`)
    return response !== null ? response : error
}  

//获取留言信息
export async function getMessage(id) {
    console.log(id)
    let [response, error] = await get(`/home/getMessage`,{id})
    //console.log(response)
    return response !== null ? response : error
}

//插入留言信息
export async function insterMess(data) {
    let [response, error] = await post(`/home/insterMess`,{...data})
    //console.log(response)
    return response !== null ? response : error
}